<script>
  import config from './config'
  import store from '@/store'
  import { getToken } from '@/utils/auth'
  import { getThis } from '@/utils/request'
  import { getThis2 } from '@/utils/request2'
  import { getThis3 } from '@/utils/ajax'
  import alarmProcess from '@/utils/alarmProcess'
  export default {
    onLaunch: function() {
		let checkFanteObject = ()=> {
			try{
				// uni.showToast({
				// 	title: "checking..."
				// })
				let fante = window["fante"]
				if(fante){
					// uni.showToast({
					// 	title: "ready"
					// })
					window.processAlarm = alarmProcess
				}
				else{
					setTimeout(checkFanteObject, 100)
				}
			}
			catch(e){
				
			}			
		}
		setTimeout(checkFanteObject, 500)
        this.initApp()
	    getThis(this)
	    getThis2(this)
		getThis3(this)
    },
    methods: {
      // 初始化应用
      initApp() {
		localStorage.setItem("thisLog",this)
		//默认关闭调试模式
		// if(localStorage.getItem("logFlag")!=null){
		// 	localStorage.setItem("logFlag",false)
		// }
        // 初始化应用配置
        this.initConfig()
        // 检查用户登录状态
        //#ifdef H5
        this.checkLogin()
        //#endif
      },
      initConfig() {
        this.globalData.config = config
      },
      checkLogin() {
        if (!getToken()) {
          this.$tab.reLaunch('/pages/login') 
        }
      }
    }
  }
</script>

<style lang="scss">
  @import '@/static/scss/index.scss'
</style>